package other.nowcoder.easy;

import java.util.Scanner;

/**
 * @author bruin_du
 * @description 小易的升级之路
 * https://www.nowcoder.com/practice/fe6c73cb899c4fe1bdd773f8d3b42c3d?
 * tpId=49&&tqId=29329&rp=1&ru=/activity/oj&qru=/ta/2016test/question-ranking
 * @date 2022/5/20 15:01
 **/
public class RoadOfUpgrade {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextInt()){
            int monsterNum = in.nextInt();
            int defaultAbility = in.nextInt();
            for (int i = 0; i < monsterNum; i++) {
                int monsterAbility = in.nextInt();
                if(monsterAbility > defaultAbility)
                    defaultAbility += maxDivisor(defaultAbility,monsterAbility);
                else
                    defaultAbility += monsterAbility;
            }
            System.out.println(defaultAbility);
        }
    }

    private static int maxDivisor(int a, int b) {
        int divisor = 0;
        while((divisor = a % b) != 0){
            a = Math.max(b,divisor);
            b = Math.min(b,divisor);
        }
        return b;
    }
}
